package com.wn.controller;

import com.common.entity.*;
import com.wn.service.GuideoneService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GuideoneController {

    @Autowired
    GuideoneService guideoneService;

    //    @SystemControllerLog(description = "分页查询用户信息")
    @PostMapping("/searchSomeGuideoneByPage")
//    @RequireRoles(roles = {"admin","super_admin","reception","guide","tourist"},index = 1)
    @ApiOperation("查询所有 支持 多条件 分页 排序 查询")
    public Rsp searchSomeByPage(@RequestBody PageParam<Guide> guidePageParam, @RequestHeader("token") String token) {

        return Rsp.success(guideoneService.searchSomeByPage(guidePageParam));
    }

    @PostMapping("/addOneguideone")
    @ApiOperation("添加")
    public Rsp addOneguideone(@RequestBody Guide guide, @RequestHeader("token") String token) {
        System.out.println(guide.toString());
        return guideoneService.addOne(guide);
    }

    @PostMapping("/updateguideone")
    @ApiOperation("修改")
    public Rsp updateguideone(@RequestBody Guide guide, @RequestHeader("token") String token) {
        System.out.println(guide.toString());
        return guideoneService.update(guide);
    }

    @PostMapping("/deleteLogicalguide")
    @ApiOperation("逻辑删除")
    public Rsp deleteLogicalguide(@RequestBody Guide guide) {
        return guideoneService.deleteLogical(guide);
    }
}
